#!/usr/bin/env groovy -classpath src/main/groovy

import net.forty2ware.vintagesofa.Server

def server = new Server('hostname':'localhost', 'port':5984)

server.databases.each{ database ->
  def doc = database.getDocument()
  doc.data = [
    'type'    : 'notice',
    'created' : new Date(),
  ]

  def response = doc.create()
  if (response.ok) {
    println "Created record: ${doc.url}"
  } else {
    println response
  }
}
